<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  

  
  <title>备忘录</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta property="og:type" content="website">
<meta property="og:title" content="备忘录">
<meta property="og:url" content="http://yoursite.com/index.html">
<meta property="og:site_name" content="备忘录">
<meta property="og:locale" content="default">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="备忘录">
  
    <link rel="alternate" href="/atom.xml" title="备忘录" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link rel="stylesheet" href="/css/style.css">
</head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">备忘录</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Search"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://yoursite.com"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main">
  
    <article id="post-第五篇redis安装配置" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2018/04/15/第五篇redis安装配置/" class="article-date">
  <time datetime="2018-04-15T08:16:55.851Z" itemprop="datePublished">2018-04-15</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
    <div class="article-entry" itemprop="articleBody">
      
        <hr>
<h2 id="第五篇redis安装配置"><a href="#第五篇redis安装配置" class="headerlink" title="第五篇redis安装配置"></a>第五篇redis安装配置</h2><p>centOS下redis安装配置</p>
<h2 id="Quick-Start"><a href="#Quick-Start" class="headerlink" title="Quick Start"></a>Quick Start</h2><h3 id="1-安装"><a href="#1-安装" class="headerlink" title="1.安装"></a>1.安装</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br></pre></td><td class="code"><pre><span class="line"> $ <span class="built_in">cd</span> /usr/<span class="built_in">local</span>/src</span><br><span class="line"> $ wget http://download.redis.io/releases/redis-3.2.8.tar.gz</span><br><span class="line"> $ tar xzf redis-3.2.8.tar.gz</span><br><span class="line"> $ <span class="built_in">cd</span> redis-3.2.8</span><br><span class="line"> 编译：</span><br><span class="line">先阅读README</span><br><span class="line"> To force compiling against libc malloc,use:</span><br><span class="line"> % make MALLOC=libc</span><br><span class="line"> To compile against jemalloc on Mac OS X systems,use:</span><br><span class="line"> % make MALLOC=jemalloc</span><br><span class="line">所以</span><br><span class="line">如果是linux系统 使用</span><br><span class="line"> $ make MALLOC=libc</span><br><span class="line"> 编译</span><br><span class="line"> 编译成功之后，运行 </span><br><span class="line"> $ make install</span><br><span class="line"> </span><br><span class="line"> 再看README 文件</span><br><span class="line"> In order to install Redis binaries into/usr/<span class="built_in">local</span>/bin just use:</span><br><span class="line"> % make install</span><br><span class="line"> You can use`make PREFIX=/some/other/directory install`<span class="keyword">if</span> you wish to use a</span><br><span class="line"> different destination.</span><br><span class="line"> Make install will just install binaries <span class="keyword">in</span> your system, but will not configure</span><br><span class="line"> init scripts and configuration files <span class="keyword">in</span> the appropriate place.</span><br><span class="line"> </span><br><span class="line"> 当安装完毕之后，只生成了4个可执行的二进制文件</span><br><span class="line"> </span><br><span class="line">  [root@localhost bin]<span class="comment"># pwd</span></span><br><span class="line">  /usr/<span class="built_in">local</span>/bin</span><br><span class="line">  [root@localhost bin]<span class="comment"># ll</span></span><br><span class="line">  total 6880</span><br><span class="line">  -rwxr-xr-x.1 root root 337792Mar809:32 redis-benchmark</span><br><span class="line">  -rwxr-xr-x.1 root root 25176Mar809:32 redis-check-aof</span><br><span class="line">  -rwxr-xr-x.1 root root 3091736Mar809:32 redis-check-rdb</span><br><span class="line">  -rwxr-xr-x.1 root root 490832Mar809:32 redis-cli 客户端</span><br><span class="line">  lrwxrwxrwx.1 root root 12Mar809:32 redis-sentinel -&gt; redis-server</span><br><span class="line"> -rwxr-xr-x.1 root root 3091736Mar809:32 redis-server 服务端</span><br><span class="line"> </span><br><span class="line"> 为了正常使用，还必须进行下一步操作：</span><br><span class="line"> </span><br><span class="line"><span class="keyword">if</span> you are installing</span><br><span class="line"> it the proper way <span class="keyword">for</span> a production system, we have a script doing this</span><br><span class="line"> forUbuntuandDebian systems:</span><br><span class="line"> % <span class="built_in">cd</span> utils</span><br><span class="line"> %./install_server.sh</span><br><span class="line"> The script will ask you a few questions and will setup everything you need</span><br><span class="line"> to run Redis properly as a background daemon that will start again on</span><br><span class="line"> system reboots.</span><br><span class="line"> 一路下一步，安装完成后，产生以下文件</span><br><span class="line"> Selected config:</span><br><span class="line"> Port           :6379</span><br><span class="line"> Config file    :/etc/redis/6379.conf</span><br><span class="line"> Log file       :/var/<span class="built_in">log</span>/redis_6379.log</span><br><span class="line"> Data dir       :/var/lib/redis/6379</span><br><span class="line"> Executable     :/usr/<span class="built_in">local</span>/bin/redis-server</span><br><span class="line"> CliExecutable:/usr/<span class="built_in">local</span>/bin/redis-cli</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/writing.html" target="_blank" rel="noopener">Writing</a></p>
<h3 id="2-客户端测试"><a href="#2-客户端测试" class="headerlink" title="2.客户端测试"></a>2.客户端测试</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">开启服务</span><br><span class="line"> [root@localhost bin]<span class="comment"># pwd</span></span><br><span class="line"> /usr/<span class="built_in">local</span>/bin</span><br><span class="line"> [root@localhost bin]<span class="comment">#./redis-server</span></span><br><span class="line"> 或者是</span><br><span class="line"> ./redis-server /etc/redis/6379.conf （对应的配置文件）</span><br><span class="line"> 进入客户端</span><br><span class="line"> </span><br><span class="line">[root@localhost bin]<span class="comment">#./redis-cli</span></span><br><span class="line"> 127.0.0.1:6379&gt;<span class="built_in">set</span> key1 aa</span><br><span class="line"> OK</span><br><span class="line"> 127.0.0.1:6379&gt;get key1</span><br><span class="line"><span class="string">"aa"</span></span><br><span class="line"> 127.0.0.1:6379&gt;<span class="built_in">exit</span></span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/server.html" target="_blank" rel="noopener">Server</a></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2018/04/15/第五篇redis安装配置/" data-id="cjg0knacf0000vsom83qvgwwj" class="article-share-link">Share</a>
      
      
    </footer>
  </div>
  
</article>


  
    <article id="post-第四篇FTP的安装配置" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2018/04/15/第四篇FTP的安装配置/" class="article-date">
  <time datetime="2018-04-15T08:16:39.039Z" itemprop="datePublished">2018-04-15</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
    <div class="article-entry" itemprop="articleBody">
      
        <hr>
<h2 id="第四篇FTP的安装配置"><a href="#第四篇FTP的安装配置" class="headerlink" title="第四篇FTP的安装配置 "></a>第四篇FTP的安装配置 </h2><p>CentOs7下ftp的安装与配置</p>
<h2 id="Quick-Start"><a href="#Quick-Start" class="headerlink" title="Quick Start"></a>Quick Start</h2><h3 id="1-安装vsftpd"><a href="#1-安装vsftpd" class="headerlink" title="1. 安装vsftpd"></a>1. 安装vsftpd</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#安装vsftpd</span></span><br><span class="line">yum install -y vsftpd</span><br><span class="line"><span class="comment">#设置开机启动</span></span><br><span class="line">systemctl <span class="built_in">enable</span> vsftpd.service </span><br><span class="line"><span class="comment"># 重启</span></span><br><span class="line">service vsftpd restart</span><br><span class="line"><span class="comment"># 查看vsftpd服务的状态</span></span><br><span class="line">systemctl status vsftpd.service</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/writing.html" target="_blank" rel="noopener">Writing</a></p>
<h3 id="2-配置vsftpd-conf"><a href="#2-配置vsftpd-conf" class="headerlink" title="2. 配置vsftpd.conf"></a>2. 配置vsftpd.conf</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#备份配置文件 </span></span><br><span class="line">cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.bak</span><br><span class="line"></span><br><span class="line"><span class="comment">#执行以下命令</span></span><br><span class="line">sed -i <span class="string">"s/anonymous_enable=YES/anonymous_enable=NO/g"</span> <span class="string">'/etc/vsftpd/vsftpd.conf'</span></span><br><span class="line"></span><br><span class="line">sed -i <span class="string">"s/#anon_upload_enable=YES/anon_upload_enable=NO/g"</span> <span class="string">'/etc/vsftpd/vsftpd.conf'</span></span><br><span class="line"></span><br><span class="line">sed -i <span class="string">"s/#anon_mkdir_write_enable=YES/anon_mkdir_write_enable=YES/g"</span> <span class="string">'/etc/vsftpd/vsftpd.conf'</span></span><br><span class="line"></span><br><span class="line">sed -i <span class="string">"s/#chown_uploads=YES/chown_uploads=NO/g"</span> <span class="string">'/etc/vsftpd/vsftpd.conf'</span></span><br><span class="line"></span><br><span class="line">sed -i <span class="string">"s/#async_abor_enable=YES/async_abor_enable=YES/g"</span> <span class="string">'/etc/vsftpd/vsftpd.conf'</span></span><br><span class="line"></span><br><span class="line">sed -i <span class="string">"s/#ascii_upload_enable=YES/ascii_upload_enable=YES/g"</span> <span class="string">'/etc/vsftpd/vsftpd.conf'</span></span><br><span class="line"></span><br><span class="line">sed -i <span class="string">"s/#ascii_download_enable=YES/ascii_download_enable=YES/g"</span> <span class="string">'/etc/vsftpd/vsftpd.conf'</span></span><br><span class="line"></span><br><span class="line">sed -i <span class="string">"s/#ftpd_banner=Welcome to blah FTP service./ftpd_banner=Welcome to FTP service./g"</span> <span class="string">'/etc/vsftpd/vsftpd.conf'</span></span><br><span class="line"></span><br><span class="line"><span class="comment">#添加下列内容到vsftpd.conf末尾</span></span><br><span class="line">use_localtime=YES</span><br><span class="line">listen_port=21</span><br><span class="line">chroot_local_user=YES</span><br><span class="line">idle_session_timeout=300</span><br><span class="line">guest_enable=YES</span><br><span class="line">guest_username=vsftpd</span><br><span class="line">user_config_dir=/etc/vsftpd/vconf</span><br><span class="line">data_connection_timeout=1</span><br><span class="line">virtual_use_local_privs=YES</span><br><span class="line">pasv_min_port=10060</span><br><span class="line">pasv_max_port=10090</span><br><span class="line">accept_timeout=5</span><br><span class="line">connect_timeout=1</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/server.html" target="_blank" rel="noopener">Server</a></p>
<h3 id="3-建立用户文件"><a href="#3-建立用户文件" class="headerlink" title="3. 建立用户文件"></a>3. 建立用户文件</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#第一行用户名，第二行密码，不能使用root为用户名</span></span><br><span class="line">vi /etc/vsftpd/virtusers</span><br><span class="line">chris</span><br><span class="line">123456</span><br><span class="line">shidajian</span><br><span class="line">123456</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/generating.html" target="_blank" rel="noopener">Generating</a></p>
<h3 id="4-生成用户数据文件"><a href="#4-生成用户数据文件" class="headerlink" title="4. 生成用户数据文件"></a>4. 生成用户数据文件</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">db_load -T -t <span class="built_in">hash</span> -f /etc/vsftpd/virtusers /etc/vsftpd/virtusers.db</span><br><span class="line"></span><br><span class="line"><span class="comment">#设定PAM验证文件，并指定对虚拟用户数据库文件进行读取</span></span><br><span class="line"></span><br><span class="line">chmod 600 /etc/vsftpd/virtusers.db</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/deployment.html" target="_blank" rel="noopener">Deployment</a></p>
<h3 id="5-修改-etc-pam-d-vsftpd文件"><a href="#5-修改-etc-pam-d-vsftpd文件" class="headerlink" title="5. 修改/etc/pam.d/vsftpd文件"></a>5. 修改/etc/pam.d/vsftpd文件</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 修改前先备份 </span></span><br><span class="line"></span><br><span class="line">cp /etc/pam.d/vsftpd /etc/pam.d/vsftpd.bak</span><br><span class="line"></span><br><span class="line"><span class="comment"># 将auth及account的所有配置行均注释掉</span></span><br><span class="line">vi /etc/pam.d/vsftpd</span><br><span class="line"></span><br><span class="line">auth sufficient /lib64/security/pam_userdb.so db=/etc/vsftpd/virtusers</span><br><span class="line"></span><br><span class="line">account sufficient /lib64/security/pam_userdb.so db=/etc/vsftpd/virtusers</span><br><span class="line"></span><br><span class="line"><span class="comment"># 如果系统为32位，上面改为lib</span></span><br></pre></td></tr></table></figure>
<h3 id="6-新建系统用户vsftpd，用户目录为-home-vsftpd"><a href="#6-新建系统用户vsftpd，用户目录为-home-vsftpd" class="headerlink" title="6. 新建系统用户vsftpd，用户目录为/home/vsftpd"></a>6. 新建系统用户vsftpd，用户目录为/home/vsftpd</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#用户登录终端设为/bin/false(即：使之不能登录系统)</span></span><br><span class="line">useradd vsftpd -d /home/vsftpd -s /bin/<span class="literal">false</span></span><br><span class="line">chown -R vsftpd:vsftpd /home/vsftpd</span><br></pre></td></tr></table></figure>
<h3 id="7-建立虚拟用户个人配置文件"><a href="#7-建立虚拟用户个人配置文件" class="headerlink" title="7.建立虚拟用户个人配置文件"></a>7.建立虚拟用户个人配置文件</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">mkdir /etc/vsftpd/vconf</span><br><span class="line"><span class="built_in">cd</span> /etc/vsftpd/vconf</span><br><span class="line"></span><br><span class="line"><span class="comment">#这里建立两个虚拟用户配合文件</span></span><br><span class="line">touch chris chang</span><br><span class="line"></span><br><span class="line"><span class="comment">#建立用户根目录</span></span><br><span class="line">mkdir -p /home/vsftpd/chris/</span><br><span class="line"></span><br><span class="line"><span class="comment">#编辑chris用户配置文件，内容如下，其他用户类似</span></span><br><span class="line">vi chris</span><br><span class="line"></span><br><span class="line">local_root=/home/vsftpd/chris/</span><br><span class="line">write_enable=YES</span><br><span class="line">anon_world_readable_only=NO</span><br><span class="line">anon_upload_enable=YES</span><br><span class="line">anon_mkdir_write_enable=YES</span><br><span class="line">anon_other_write_enable=YES</span><br></pre></td></tr></table></figure>
<h3 id="8-防火墙设置"><a href="#8-防火墙设置" class="headerlink" title="8. 防火墙设置"></a>8. 防火墙设置</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">vi /etc/sysconfig/iptables</span><br><span class="line"><span class="comment">#编辑iptables文件，添加如下内容，开启21端口</span></span><br><span class="line">-A INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCE</span><br></pre></td></tr></table></figure>
<h3 id="9-重启vsftpd服务器"><a href="#9-重启vsftpd服务器" class="headerlink" title="9. 重启vsftpd服务器"></a>9. 重启vsftpd服务器</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">service vsftpd restart</span><br></pre></td></tr></table></figure>
<h3 id="10-使用xftp等软件连接测试"><a href="#10-使用xftp等软件连接测试" class="headerlink" title="10. 使用xftp等软件连接测试"></a>10. 使用xftp等软件连接测试</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"></span><br></pre></td></tr></table></figure>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2018/04/15/第四篇FTP的安装配置/" data-id="cjg0knacf0001vsomypfrs7nn" class="article-share-link">Share</a>
      
      
    </footer>
  </div>
  
</article>


  
    <article id="post-第三篇tomcat的安装配置" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2018/04/15/第三篇tomcat的安装配置/" class="article-date">
  <time datetime="2018-04-15T08:16:27.732Z" itemprop="datePublished">2018-04-15</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
    <div class="article-entry" itemprop="articleBody">
      
        <hr>
<h2 id="第三篇博客"><a href="#第三篇博客" class="headerlink" title="第三篇博客 "></a>第三篇博客 </h2><p>centOs下tomcat7安装配置</p>
<h2 id="Quick-Start"><a href="#Quick-Start" class="headerlink" title="Quick Start"></a>Quick Start</h2><h3 id="下载"><a href="#下载" class="headerlink" title="下载"></a>下载</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">首先需要下载tomcat7的安装文件，地址如下： </span><br><span class="line">http://mirror.bit.edu.cn/apache/tomcat/tomcat-7/v7.0.69/bin/apache-tomcat-7.0.69.tar.gz</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/writing.html" target="_blank" rel="noopener">Writing</a></p>
<h3 id="安装与配置"><a href="#安装与配置" class="headerlink" title="安装与配置"></a>安装与配置</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line">安装之前需要确保已经安装JDK，若没有安装JDK请参考上一篇blog先正确安装JDK： Linux CentOS 7 &amp; JDK 1.7 </span><br><span class="line">安装与配置，如果已经安装JDK，那么就接下来就可以安装tomcat了，首先将下载的安装文件上传到Linux服务器的相应目录，第一步是解压：</span><br><span class="line"></span><br><span class="line">tar -zxvf apache-tomcat-7.0.57.tar.gz</span><br><span class="line">解压完整后删除安装包：</span><br><span class="line"></span><br><span class="line">rm -rf apache-tomcat-7.0.57.tar.gz</span><br><span class="line">考虑后面要做tomcat集群，所以从新建立新目录并将解压好的tomcat移进去：</span><br><span class="line"></span><br><span class="line">mkdir /wocloud/tomcat_cluster/</span><br><span class="line">mkdir /wocloud/tomcat_cluster/tomcat1</span><br><span class="line">mv ./apache-tomcat-7.0.57/ /wocloud/tomcat_cluster/tomcat1/</span><br><span class="line">首先我们来配置一下tomcat的环境变量和内存设置，进入tomcat的bin目录后通过vi命令打开catalina.sh文件，并在其中加入如下配置：</span><br><span class="line"></span><br><span class="line">JAVA_OPTS=<span class="string">"-Xms512m -Xmx1024m -Xss1024K -XX:PermSize=512m -XX:MaxPermSize=1024m"</span></span><br><span class="line"><span class="built_in">export</span> TOMCAT_HOME=/wocloud/tomcat_cluster/tomcat1/apache-tomcat-7.0.57</span><br><span class="line"><span class="built_in">export</span> CATALINA_HOME=/wocloud/tomcat_cluster/tomcat1/apache-tomcat-7.0.57</span><br><span class="line"><span class="built_in">export</span> JRE_HOME=/wocloud/java/jdk1.7.0_75/jre</span><br><span class="line"><span class="built_in">export</span> JAVA_HOME=/wocloud/java/jdk1.7.0_75</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/server.html" target="_blank" rel="noopener">Server</a></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2018/04/15/第三篇tomcat的安装配置/" data-id="cjg0k00vs0000rcom9dir4d91" class="article-share-link">Share</a>
      
      
    </footer>
  </div>
  
</article>


  
    <article id="post-第二篇JDK的安装" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2018/04/15/第二篇JDK的安装/" class="article-date">
  <time datetime="2018-04-15T08:10:22.264Z" itemprop="datePublished">2018-04-15</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
    <div class="article-entry" itemprop="articleBody">
      
        <hr>
<h2 id="第二篇JDK的安装"><a href="#第二篇JDK的安装" class="headerlink" title="第二篇JDK的安装"></a>第二篇JDK的安装</h2><p>centOS下jdk安装与配置</p>
<h2 id="Quick-Start"><a href="#Quick-Start" class="headerlink" title="Quick Start"></a>Quick Start</h2><h3 id="1-下载JDK"><a href="#1-下载JDK" class="headerlink" title="1. 下载JDK"></a>1. 下载JDK</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">先查看Linux系统是多少位（32位/64位）：getconf  LONG_BIT。再从JDK官网</span><br><span class="line">（http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html）</span><br><span class="line">下载JDK 7，Linux 64位下载jdk-7u60-linux-x64.tar.gz。</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/writing.html" target="_blank" rel="noopener">Writing</a></p>
<h3 id="2-解压安装"><a href="#2-解压安装" class="headerlink" title="2. 解压安装"></a>2. 解压安装</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">2.1选择安装JDK的位置/usr/java，如果存在这个目录无需创建，一般新到的机器是没有这个目录的，这个我们创建这个目录。</span><br><span class="line">sudo mkdir /usr/java </span><br><span class="line">2.2将jdk-7u60-linux-x64.tar.gz上传到服务器，移动到/usr/java。</span><br><span class="line">2.3解压：进入/usr/java目录（<span class="built_in">cd</span> usr/java）解压</span><br><span class="line">sudo tar -zxvfjdk-7u60-linux-x64.gz </span><br><span class="line">2.4删除jdk-7u60-linux-x64.tar.gz</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/server.html" target="_blank" rel="noopener">Server</a></p>
<h3 id="3-配置环境变量"><a href="#3-配置环境变量" class="headerlink" title="3. 配置环境变量"></a>3. 配置环境变量</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">打开/etc/profile（sudo vim /etc/profile）在最后面添加如下内容：</span><br><span class="line"><span class="built_in">export</span> JAVA_HOME=/usr/java/jdk1.7.0_60  </span><br><span class="line"><span class="built_in">export</span> JRE_HOME=/usr/java/jdk1.7.0_60/jre  </span><br><span class="line">exportCLASSPATH=.:<span class="variable">$JAVA_HOME</span>/lib/dt.jar:<span class="variable">$JAVA_HOME</span>/lib/tools.jar:<span class="variable">$JRE_HOME</span>/lib  </span><br><span class="line"><span class="built_in">export</span> PATH=<span class="variable">$PATH</span>:<span class="variable">$JAVA_HOME</span>/bin  </span><br><span class="line">让配置生效：</span><br><span class="line"></span><br><span class="line"><span class="built_in">source</span> /etc/profile</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/generating.html" target="_blank" rel="noopener">Generating</a></p>
<h3 id="4-验证"><a href="#4-验证" class="headerlink" title="4. 验证"></a>4. 验证</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">java –version  </span><br><span class="line">打印当前安装的jdk版本号java version <span class="string">"1.7.0_60"</span></span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/deployment.html" target="_blank" rel="noopener">Deployment</a></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2018/04/15/第二篇JDK的安装/" data-id="cjg0judjt00007komyrhi9j5m" class="article-share-link">Share</a>
      
      
    </footer>
  </div>
  
</article>


  
    <article id="post-hello-world" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2018/04/15/hello-world/" class="article-date">
  <time datetime="2018-04-15T07:45:43.995Z" itemprop="datePublished">2018-04-15</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2018/04/15/hello-world/">Hello World</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>Welcome to <a href="https://hexo.io/" target="_blank" rel="noopener">Hexo</a>! This is your very first post. Check <a href="https://hexo.io/docs/" target="_blank" rel="noopener">documentation</a> for more info. If you get any problems when using Hexo, you can find the answer in <a href="https://hexo.io/docs/troubleshooting.html" target="_blank" rel="noopener">troubleshooting</a> or you can ask me on <a href="https://github.com/hexojs/hexo/issues" target="_blank" rel="noopener">GitHub</a>.</p>
<h2 id="Quick-Start"><a href="#Quick-Start" class="headerlink" title="Quick Start"></a>Quick Start</h2><h3 id="Create-a-new-post"><a href="#Create-a-new-post" class="headerlink" title="Create a new post"></a>Create a new post</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo new <span class="string">"My New Post"</span></span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/writing.html" target="_blank" rel="noopener">Writing</a></p>
<h3 id="Run-server"><a href="#Run-server" class="headerlink" title="Run server"></a>Run server</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo server</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/server.html" target="_blank" rel="noopener">Server</a></p>
<h3 id="Generate-static-files"><a href="#Generate-static-files" class="headerlink" title="Generate static files"></a>Generate static files</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo generate</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/generating.html" target="_blank" rel="noopener">Generating</a></p>
<h3 id="Deploy-to-remote-sites"><a href="#Deploy-to-remote-sites" class="headerlink" title="Deploy to remote sites"></a>Deploy to remote sites</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo deploy</span><br></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/deployment.html" target="_blank" rel="noopener">Deployment</a></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2018/04/15/hello-world/" data-id="cjg0js84q00000oom1iqdh93e" class="article-share-link">Share</a>
      
      
    </footer>
  </div>
  
</article>


  


</section>
        
          <aside id="sidebar">
  
    

  
    

  
    
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/04/">April 2018</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Recent Posts</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2018/04/15/第五篇redis安装配置/">(no title)</a>
          </li>
        
          <li>
            <a href="/2018/04/15/第四篇FTP的安装配置/">(no title)</a>
          </li>
        
          <li>
            <a href="/2018/04/15/第三篇tomcat的安装配置/">(no title)</a>
          </li>
        
          <li>
            <a href="/2018/04/15/第二篇JDK的安装/">(no title)</a>
          </li>
        
          <li>
            <a href="/2018/04/15/hello-world/">Hello World</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2018 John Doe<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/script.js"></script>



  </div>
</body>
</html>